﻿@{
    ViewBag.Title = "页面列表";
    var collection = Request.QueryString;
}
@using MvcApplication.Entity
@model  PaginationResult<Post>
@helper isPostStatus(PostStatus status)
{
    if (((int)status).ToString() == Request.QueryString["status"])
    {
    @Html.Raw("selected");
    }
    else
    {
    @Html.Raw("");
    }
}

<div class="am-cf am-padding">
    <div class="am-fl am-cf">
        <strong class="am-text-primary am-text-lg">文章</strong> / 
        <small>Post</small>
    </div>
</div>
<form>
    <div class="am-g">
        <div class="am-u-sm-12 am-u-md-3">
            <div class="am-form-group">
                <select data-am-selected="{btnsize: 'sm'}" name="status">
                    <option value="null">所有状态</option>
                    <option value="@((int)PostStatus.发布)" @isPostStatus(PostStatus.发布)>发布</option>
                    <option value="@((int)PostStatus.草稿)" @isPostStatus(PostStatus.草稿)>草稿</option>
                </select>
            </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
            <div class="am-form-group">
                <select data-am-selected="{btnsize: 'sm'}">
                    <option value="option1">所有类别</option>
                    <option value="option2">it业界</option>
                    <option value="option3">数码产品</option>
                    <option value="option3">笔记本电脑</option>
                    <option value="option3">平板电脑</option>
                    <option value="option3">只能手机</option>
                    <option value="option3">超极本</option>
                </select>
            </div>

        </div>
        <div class="am-u-sm-12 am-u-md-6">
            <div class="am-input-group am-input-group-sm">
                <input type="text" class="am-form-field" name="title" value="@Request.QueryString["title"]">
                <span class="am-input-group-btn">
                    <button class="am-btn am-btn-default" type="submit">搜索</button>
                </span>
            </div>
        </div>
    </div>
</form>
<div class="am-g">
    <div class="am-u-sm-12 am-u-md-6">
        <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
                <button type="button" class="am-btn am-btn-default" onclick="location.href='/singlepage/edit'">
                    <span class="am-icon-plus"></span>&nbsp;新增
                </button>
                <button type="button" class="am-btn am-btn-default" onclick="location.reload()">
                    <span class="am-icon-archive"></span>&nbsp;刷新
                </button>
                <button type="button"
                    onclick="toRecycle()"
                    class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only">
                    <span class="am-icon-trash-o"></span>&nbsp;移至回收站
                </button>
            </div>
        </div>
    </div>
</div>

<div class="am-g">
    <div class="am-u-sm-12">
        <form class="am-form" id="table-form">
            <table cellspacing="0" class="am-table am-table-striped am-table-hover table-main">
                <thead>
                    <tr>
                        <th>
                            <input type="checkbox" onchange="totalCheck(this)" /></th>
                        <th>ID</th>
                        <th>标题</th>
                        <th>作者</th>
                        <th>修改日期</th>
                        <th>#操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var post in Model.Datas)
                    {
                        <tr>
                            <td>
                                <input type="checkbox" name="postIds" value="@post.ID"/>
                            </td>
                            <td>@post.ID</td>
                            <td style="width: 350px;">
                                <a href="/post/index/@post.ID">@post.Title</a>
                            </td>
                            <td>测试账号1号</td>
                            <td>@post.LastModifyAt.ToString("yy年MM月dd日 hh:mm")</td>
                            <td>
                                <div class="am-dropdown" data-am-dropdown="">
                                    <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle="">
                                        <span class="am-icon-cog"></span>&nbsp;<span class="am-icon-caret-down"></span>
                                    </button>
                                    <ul class="am-dropdown-content">
                                        <li>
                                            <a href="edit/@post.ID">
                                                <span class="am-icon-pencil-square-o am-text-success"></span>&nbsp;
                                                <span class="am-text-success">编辑</span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="javascript:toRecycle(@post.ID);" class="am-text-danger">
                                                <span class="am-icon-trash-o am-text-danger"></span>&nbsp;
                                                <span class="am-text-danger">移至回收站</span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </form>
        <div>
            @{Html.RenderPartial("~/Views/Common/Pagination.cshtml", Model);}
        </div>
    </div>
</div>
@Scripts.Render("~/Content/js/single-page/list.js")